home *** CD-ROM | disk | FTP | other *** search
- /*****************************************************************************
-
- This file is part of x2600, the Atari 2600 Emulator
- ===================================================
-
- Copyright 1996 Alex Hornby. For contributions see the file CREDITS.
-
- This software is distributed under the terms of the GNU General Public
- License. This is free software with ABSOLUTELY NO WARRANTY.
-
- See the file COPYING for Details.
-
- Tweaked by Matthew Stroup for Amiga v2600, April 24, 1997.
-
- ******************************************************************************/
-
- /*
- The main program body.
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include "types.h"
- #include "display.h"
- // #include "keyboard.h"
- // #include "realjoy.h"
- #include "files.h"
- #include "vmachine.h"
- #include "options.h"
- #include "sound.h"
-
- /* The mainloop from cpu.c */
- extern void mainloop (void);
-
- /* Make sure any exit() calls free up shared memory */
- void cleanup (void)
- {
- // /* Close the raw keyboard */
- // close_keyboard ();
-
- // /* Close the PC joystick */
- // close_realjoy ();
-
- /* Close down display */
- tv_off ();
-
- /* Turn off the sound */
- sound_close ();
- }
-
- /* The main entry point */
- /* argc: number of command line arguments */
- /* argv: the argument text */
- int main (int argc, char **argv)
- {
- /* Parse options */
- parse_options (argc, argv);
-
- /* Set up the cleanup code */
- atexit (cleanup);
-
- /* Initialise the 2600 hardware */
- init_hardware ();
-
- /* Turn the virtual TV on. */
- tv_on (argc, argv);
-
- /* Turn on sound */
- sound_init ();
-
- init_realjoy ();
-
- /* load cartridge image */
- if (loadCart ())
- {
- fprintf (stderr, "Error loading cartridge image.\n");
- exit (-1);
- }
-
- /* Cannot be done until file is loaded */
- init_banking();
-
- /* start cpu */
- mainloop ();
-
- /* Thats it folks */
- exit (0);
- }
-